<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <title>${setting.siteName} - 基本参数</title>
    <meta name="keywords" content="${setting.siteName}">
    <meta name="description" content="${setting.siteName}">
    <!-- BEGIN HEADER -->
[#include "/admin/include/style.ftl"]
    <!-- END HEADER -->
    <style type="text/css">
    	body #d-content-Tips {
			z-index:200000 !important;
		}
		.modal-backdrop{
		z-index:2 !important;
		}
		.modal{
		z-index:3 !important;
		}
		.aValue{
			width:150px;
			display: inline-block;
			border-color:#ccc;
		}
		.rightText{
			font-weight:bold;
		}
        em{
            color: red;
        }
    </style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content  animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <form id="inputForm" class="form-horizontal" action="update.jhtml" method="post">
                    	<!-- ********************************** -->
                    	<div class="form-group">
                    		<div class="ibox-title">
			                    <h3>会员升级方式参数设置</h3>
			                </div>
                    		<div class="row">
                    			<div class="col-sm-1"></div>
                    			<div class="col-sm-11">
	                                    <p class="form-control-static">1.普通会员通过购买会员升级礼包升级为晋升会员</p>
	                    			
	                                    <p class="form-control-static"><em>*&nbsp;</em>
	                                    2.【晋升会员】晋升为【服务商】的方式：1.邀请&nbsp;
	                                    <input type="text" id="setA" data-id="" value="" class="input-sm form-control aValue zhengshu" placeholder="请输入" oninput="value=value.replace(/[^\d]/g,'')" required/>
	                                    &nbsp;个直属会员&nbsp;&nbsp;&nbsp;2.或者购买礼包订单总值为&nbsp;
	                                    <input type="text" id="setB" data-id="" value="" class="input-sm form-control aValue xiaoshu" placeholder="请输入" required/>
	                                    &nbsp;元
	                                    </p>
	                    			
	                                    <p class="form-control-static"><em>*&nbsp;</em>
	                                    3.【服务商】晋升为【优秀服务商】的方式：育成&nbsp;
	                                    <input type="text" id="setC" data-id="" value="" class="input-sm form-control aValue zhengshu" oninput="value=value.replace(/[^\d]/g,'')" placeholder="请输入" required/>
	                                    &nbsp;名服务商，并且团队总会员数满&nbsp;
	                                    <input type="text" id="setD" data-id="" value="" class="input-sm form-control aValue zhengshu" oninput="value=value.replace(/[^\d]/g,'')" placeholder="请输入" required/>
	                                    &nbsp;人
	                                    </p>
                    			</div>
                           </div>
                       </div>
                       <!-- ********************************** -->
                    	<div class="form-group">
                    		<div class="ibox-title">
			                    <h3>会员权益的参数设置</h3>
			                </div>
                    		<div class="row">
                    			<div class="col-sm-1"></div>
                    			<div class="col-sm-11">
                    				<p class="form-control-static rightText"><em>*&nbsp;</em>晋升会员:</p>
	                    			<p class="form-control-static">
	                                	获取一级会员的成为晋升会员礼包金额&nbsp;
	                                <input type="text" id="setE" data-id="" value="" class="input-sm form-control aValue xiaoshu" placeholder="请输入" required/>
	                                &nbsp;%
	                                </p>
                    			</div>
                           </div>
                           <div class="row">
                           		<div class="col-sm-1"></div>
                    			<div class="col-sm-11">
                    				<p class="form-control-static rightText"><em>*&nbsp;</em>服务商:</p>
	                    			<p class="form-control-static">
	                                	获取一级会员的成为晋升会员礼包金额&nbsp;
	                                <input type="text" id="setF" data-id="" value="" class="input-sm form-control aValue xiaoshu" placeholder="请输入" required/>
	                                &nbsp;%
	                                </p>
	                    			<p class="form-control-static">
	                                	获取二级会员的成为晋升会员礼包金额&nbsp;
	                                <input type="text" id="setG" data-id="" value="" class="input-sm form-control aValue xiaoshu" placeholder="请输入" required/>
	                                &nbsp;%
	                                </p>
                    			</div>
                           </div>
                           <div class="row">
                           		<div class="col-sm-1"></div>
                    			<div class="col-sm-11">
                    				<p class="form-control-static rightText"><em>*&nbsp;</em>优秀服务商:</p>
	                    			<p class="form-control-static">
	                                	获取一级会员的成为晋升会员礼包金额&nbsp;
	                                <input type="text" id="setH" data-id="" value="" class="input-sm form-control aValue xiaoshu" placeholder="请输入" required/>
	                                &nbsp;%
	                                </p>
	                    			<p class="form-control-static">
	                                	获取二级会员的成为晋升会员礼包金额&nbsp;
	                                <input type="text" id="setI" data-id="" value="" class="input-sm form-control aValue xiaoshu" placeholder="请输入" required/>
	                                &nbsp;%
	                                </p>
                    			</div>
                           </div>
                       </div>
                       <!-- ********************************** -->
                    	<div class="form-group">
                    		<div class="ibox-title">
			                    <h3>推广注册红包参数设置</h3>
			                </div>
                    		<div class="row">
                    			<div class="col-sm-1"></div>
                    			<div class="col-sm-11">
	                                    <p class="form-control-static">
                                            <em>*&nbsp;</em> 推荐注册&nbsp;
	                                    <input type="text" id="setJ" data-id="" value="" class="input-sm form-control aValue xiaoshu" placeholder="请输入" required/>
	                                    &nbsp;元
	                                    </p>
                    			</div>
                           </div>
                       </div>
                       <!-- ********************************** -->
                    	<div class="form-group">
                    		<div class="ibox-title">
			                    <h3>推广商家红包参数设置</h3>
			                </div>
                    		<div class="row">
                    			<div class="col-sm-1"></div>
                    			<div class="col-sm-11">
	                                    <p class="form-control-static">
                                            <em>*&nbsp;</em> 推广商家红包&nbsp;
	                                    <input type="text" id="setK" data-id="" value="" class="input-sm form-control aValue xiaoshu" placeholder="请输入" required/>
	                                    &nbsp;元
	                                    </p>
                    			</div>
                           </div>
                       </div>
                       <div class="hr-line-dashed"></div>
	                    <div class="form-group">
	                        <div class="col-sm-12 col-sm-offset-10">
	                            <button class="btn btn-success" type="button" id="sub">保存内容</button>
	                        </div>
	                    </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- BEGIN Script -->
[#include "/admin/include/script.ftl"]
<!-- END Script -->
<script type="text/javascript">
	$(function() {
		var list = '${json}';
    	var json = JSON.parse(list);
    	//设置默认参数
    	$.each(json, function(index, item) {
    		if (item.id == 3) {
    			$('#setA').val(item.AValue);
    			$('#setA').attr('data-id',item.id);
    		}
    		if (item.id == 4) {
    			$('#setB').val(item.AValue);
    			$('#setB').attr('data-id',item.id);
    		}
    		if (item.id == 5) {
    			$('#setC').val(item.AValue);
    			$('#setC').attr('data-id',item.id);
    		}
    		if (item.id == 6) {
    			$('#setD').val(item.AValue);
    			$('#setD').attr('data-id',item.id);
    		}
    		if (item.id == 7) {
    			$('#setE').val(item.AValue);
    			$('#setE').attr('data-id',item.id);
    		}
    		if (item.id == 8) {
    			$('#setF').val(item.AValue);
    			$('#setF').attr('data-id',item.id);
    		}
    		if (item.id == 9) {
    			$('#setG').val(item.AValue);
    			$('#setG').attr('data-id',item.id);
    		}
    		if (item.id == 10) {
    			$('#setH').val(item.AValue);
    			$('#setH').attr('data-id',item.id);
    		}
    		if (item.id == 11) {
    			$('#setI').val(item.AValue);
    			$('#setI').attr('data-id',item.id);
    		}
    		if (item.id == 12) {
    			$('#setJ').val(item.AValue);
    			$('#setJ').attr('data-id',item.id);
    		}
    		if (item.id == 13) {
    			$('#setK').val(item.AValue);
    			$('#setK').attr('data-id',item.id);
    		}
    	})
	})
	
	//整数控制
	$('.zhengshu').change(function() {
		var _va = $(this).val();
		if (_va != '') {
			$(this).val(parseInt(_va, 10));
		}
	})
	
	//带小数的输入框控制
	$(".xiaoshu").keyup(function () {
        var reg = $(this).val().match(/\d+\.?\d{0,2}/);
        var txt = '';
        if (reg != null) {
            txt = reg[0];
        }
        $(this).val(txt);
    }).change(function () {
        $(this).keyup();
    });
	
	$(".xiaoshu").change(function() {
		var _va = $(this).val();
		if (_va != '') {
			$(this).val(parseFloat(_va));
		}
	})
	
	
	//提交修改数据
	$('#sub').click(function() {
		$('.aValue').css("border-color","#ddd");
		var flag = true;
		var json = '';
		json += '[';
		$('.aValue').each(function(index, item) {
			var id = $(this).attr('data-id');
			var _value = $(this).val();
			if (id == '' || _value == '') {
				flag = false;
				art.warn('参数不能为空');
				$(this).css("border-color","red");
				return false;
			}
			if (index != 0) {
				json += ',';
			}
			json += ('{');
			json += ('"id":"'+ id +'"');
			json += (',"AValue":"'+ _value +'"');
			json += ('}');
		})
		json += ']';
		
		if (flag) {
			a_show = layer.load();
			$.ajax({
				url: '${base}/admin/parameter_setting/update_member.jhtml',
				type: 'POST',
				data: {json: json},
				dataType: 'json',
				success: function(resp){
					layer.close(a_show);
					art.message(resp);
					if (resp.type == 'success') {
						window.setTimeout(function() {
							window.location.reload();
						}, 1000)
					}
				}
			})
		}
	})
</script>
</body>
</html>
